#include <iostream>
#include "simplefactory.h"
#include "shape.h"

using namespace std;

SimpleFactory::SimpleFactory()
{
    cout << "SimpleFactory" << endl;
}

SimpleFactory::~SimpleFactory()
{
    cout <<"~SimpleFactory" << endl;
}

Shape* SimpleFactory::Draw(int shapeType)
{
    Shape *shape = NULL;
    switch (shapeType)
    {
        case SHAPE_SQUARE:
            shape = new Square;
            break;
        case SHAPE_CIRCLE:
            shape = new Circle;
            break;
        default:
            cout << "No support: " << shapeType << endl;
    }

    return shape;
}

void SimpleFactory::Erase(Shape *shape)
{
    if (!shape)
    {
        return;
    }

    delete shape;
}

